FROM ubuntu:15.04

MAINTAINER LiHongen <lihongn@henu.edu.cn>
# Replace shell with bash so we can source files
RUN rm /bin/sh && ln -s /bin/bash /bin/sh

# Install base dependencies
RUN apt-get update && apt-get install -y -q --no-install-recommends \
        apt-transport-https \
        build-essential \
        ca-certificates \
        curl \
        git \
        libssl-dev \
        software-properties-common \
        wget \
    && rm -rf /var/lib/apt/lists/*

ENV NVM_DIR /usr/local/nvm
ENV NODE_VERSION 3.0.0
RUN wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.26.0/install.sh | bash \
  && source $NVM_DIR/nvm.sh \
  && nvm install $NODE_VERSION \
  && nvm alias default $NODE_VERSION \
  && nvm use default \
  && git clone https://git.oschina.net/rednode/express-template.git \
  && cd express-template \
  && npm install \
  && npm start
EXPOSE 3000
ENV NODE_PATH $NVM_DIR/versions/iojs/v$NODE_VERSION/lib/node_modules
ENV PATH      $NVM_DIR/versions/iojs/v$NODE_VERSION/bin:$PATH
